<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Getting Started with ml5.js</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../common/tensorflow-0.9.0.js"></script>
  </head>

  <body>

    <script>
      tf.setBackend('cpu')

      var bias = tf.tensor(502.89)
      var weights = tf.tensor(-134.44)

      function predict(x){
        var output = tf.tensor(x).mul(weights).add(bias)
        return output.dataSync()[0]
      }

      var game = new PlaneFire(null,600,500)

      async function init(){
        var stateObj = game.getState()
        if(stateObj.stepOver == flase){
          var output = predict(stateObj.state)
          game.step(output)
        }

        await tf.nextFrame()
      }

      init()

    </script>
  </body>
</html>